﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace EmployeesWithGridView
{
    public partial class Details : System.Web.UI.Page
    {
        private int id;

        protected void Page_Load(object sender, EventArgs e)
        {
            id = Convert.ToInt32(Request.QueryString["id"]);
            EmployeesDataContext context = new EmployeesDataContext();
            var res =
                from em in context.Employees
                where em.EmployeeID == id
                select em;
            if (!Page.IsPostBack)
            {
                if(res != null)
                {
                    employeeDetailsView.DataSource = res;    
                    DataBind();
                }
            }
        }
    }
}